package com.IC.base.service.impl;

import com.IC.base.mapper.AccessControlRecordMapper;
import com.IC.base.service.AccessControlRecordService;
import com.IC.domain.po.AccessControlRecordPO;
import com.IC.domain.vo.AccessControlRecordVO;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AccessControlRecordServiceImpl extends ServiceImpl<AccessControlRecordMapper, AccessControlRecordPO> implements AccessControlRecordService {

    @Autowired
    private AccessControlRecordMapper accesscontrolRecordMapper;

    @Autowired
    private KafkaTemplate<Object, Object> kafkaTemplate;

    @Override
    public void add(AccessControlRecordPO accessControlRecord) {
        accesscontrolRecordMapper.add(accessControlRecord);
    }

    @Override
    public List<AccessControlRecordVO> find() {
        List<AccessControlRecordVO> list = accesscontrolRecordMapper.find();
        kafkaTemplate.send("accessControlRecord", list);
        return list;
    }


}
